<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>switch</title>
</head>
<body>
    <script>
        //switch适合做等值判断
        let num = 3;
        let day = "";
        switch (num) {
            case 1:
                day = "星期一";
                break;
            case 2:
                day = "星期二";
                break;
            case 3:
                day = "星期三";
                break;
            case 4:
                day = "星期四";
                break;
            case 5:
                day = "星期五";
                break;
            case 6:
                day = "星期六";
                break;
            case 7:
                day = "星期日";
                break;
            default:
                alert('输入有误');
                break;
        }
        if(day != ""){
            alert("今天是 "+day);
        }
    </script>
</body>
</html>